﻿using System;
using System.Collections.Generic;
using UnityEngine;

// Token: 0x02000387 RID: 903
public class LogLine : MonoBehaviour
{
	// Token: 0x0600164F RID: 5711 RVA: 0x000956D8 File Offset: 0x000938D8
	private void Start()
	{
		this.Add(0f);
		this.Add(0f);
	}

	// Token: 0x06001650 RID: 5712 RVA: 0x000956F0 File Offset: 0x000938F0
	private void Update()
	{
		int i = 0;
		while (i < this.datas.Count)
		{
			bool flag = this.datas[i].Update(this.maxTime);
			if (flag)
			{
				this.datas.RemoveAt(i);
			}
			else
			{
				i++;
			}
		}
		Vector3[] array = new Vector3[this.datas.Count];
		for (i = 0; i < this.datas.Count; i++)
		{
			float t = Mathf.InverseLerp(0f, this.maxTime, this.datas[i].timer);
			Vector3 vector = Vector3.Lerp(this.start, this.end, t);
			float d = this.datas[i].value * this.valueRate;
			vector += this.up * d;
			array[i] = vector;
		}
		this.line.positionCount = array.Length;
		this.line.SetPositions(array);
	}

	// Token: 0x06001651 RID: 5713 RVA: 0x00095804 File Offset: 0x00093A04
	public void Add(float value)
	{
		this.datas.Add(new LogLineData(value));
	}

	// Token: 0x04001A0A RID: 6666
	[SerializeField]
	private LineRenderer line;

	// Token: 0x04001A0B RID: 6667
	[SerializeField]
	private float maxTime = 3f;

	// Token: 0x04001A0C RID: 6668
	[SerializeField]
	private float valueRate = 1f;

	// Token: 0x04001A0D RID: 6669
	[SerializeField]
	private Vector3 start = new Vector3(-0.5f, 0f, 0f);

	// Token: 0x04001A0E RID: 6670
	[SerializeField]
	private Vector3 end = new Vector3(0.5f, 0f, 0f);

	// Token: 0x04001A0F RID: 6671
	[SerializeField]
	private Vector3 up = new Vector3(0f, 0.5f, 0f);

	// Token: 0x04001A10 RID: 6672
	private List<LogLineData> datas = new List<LogLineData>();
}
